const parser = require("@babel/parser");
const template = require("@babel/template").default;
const traverse = require("@babel/traverse").default;
const t= require("@babel/types");
const generator = require("@babel/generator").default;
const path = require('path');
const fs = require('fs');
const {de}=require("./module.js"); //解密函数
var content =fs.readFileSync("./source.js",{ "encoding": 'utf-8' })
var ast =parser.parse(content)

const visitor={
    CallExpression(path){
        var node=path.node;

        if (node.callee.type=="Identifier" &&node.callee.name == "_0x7969" && node.arguments.length==2 && t.isStringLiteral(node.arguments[0]) &&t.isStringLiteral(node.arguments[1]))
        {

            var val=de(node.arguments[0].value,node.arguments[1].value)
            path.replaceWith(t.StringLiteral(val))

        }
    }
}

traverse(ast,visitor)
let { code } = generator(ast);
console.log(code);